package com.mkz.job.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import com.mkz.core.common.constant.ServiceNameConstants;
import com.mkz.core.common.util.ResponseResult;
import com.mkz.job.entity.JobInfoVo;
import com.mkz.job.entity.XxlJobInfo;
import com.mkz.job.feign.factory.JobinfoServiceFallbackFactory;

import io.swagger.annotations.ApiOperation;

/**
 * ClassName: JobinfoService 
 * @Description: 动态创建/删除任务
 * @author: KuangJianyu
 * @date: 2020年4月17日
 */
@FeignClient(contextId = "jobinfoService", value = ServiceNameConstants.JOB_SERVICE, fallbackFactory = JobinfoServiceFallbackFactory.class)
public interface JobinfoClient {
	/**
              * 通过id查询任务信息
     * @param id id
     * @return ResponseResult
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    public ResponseResult getById(@PathVariable("id" ) Integer id);

    /**
              * 新增任务信息
     * @param xxlJobInfo 任务信息
     * @return ResponseResult
     */
    @ApiOperation(value = "新增任务信息", notes = "新增任务信息")
    @PostMapping
    public ResponseResult save(@RequestBody JobInfoVo jobInfoVo);

    /**
              * 修改任务信息
     * @param xxlJobInfo 任务信息
     * @return ResponseResult
     */
    @ApiOperation(value = "修改任务信息", notes = "修改任务信息")
    @PutMapping
    public ResponseResult updateById(@RequestBody XxlJobInfo xxlJobInfo);

    /**
              * 通过id删除任务信息
     * @param id id
     * @return ResponseResult
     */
    @ApiOperation(value = "通过id删除任务信息", notes = "通过id删除任务信息")
    @DeleteMapping("/{id}" )
    public ResponseResult removeById(@PathVariable Integer id);
}
